package model

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" form:"id" json:"id"`
	UserId    int32          `gorm:"column:user_id;type:int;comment:用户ID;not null;" form:"userId" json:"user_id"`                                               // 用户ID
	Price     float64        `gorm:"column:price;type:decimal(10, 2);comment:金额;not null;" form:"price" json:"price"`                                           // 金额
	Status    int8           `gorm:"column:status;type:tinyint(1);comment:状态 0: 未支付 1:已支付 2:已完成 3:已退款;not null;" form:"status" json:"status"`                   // 状态 0: 未支付 1:已支付 2:已完成 3:已退款
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);comment:下单时间;not null;default:CURRENT_TIMESTAMP(3);" form:"createdAt" json:"created_at"` // 下单时间
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"updatedAt" json:"updated_at"`
	DeletedA  gorm.DeletedAt `gorm:"column:deleted_a;type:datetime(3);default:NULL;" form:"deletedA" json:"deleted_a"`
}

func (o Order) TableName() string {
	return "order"
}
